<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@include file="./common/taglibs.jspf"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><spring:message code="webapp.page.login.title" /> | <spring:message
		code="webapp.name" /></title>
<!-- meta -->
<%@ include file="../jsp/common/meta.jspf"%>
<!-- css links -->
<%@include file="../jsp/common/links.jspf"%>
<!-- js scripts -->
<%@include file="../jsp/common/scripts.jspf"%>
</head>

<body style="background:none;">
	<center>
		<!-- header -->
		<div id="loginLogo">
			<h1>
				<a href="/"><spring:message code="webapp.name" /></a>
			</h1>
			<!--div>
				<span><a href="/?locale=zh_CN"><img title="<spring:message code="webapp.locale.china" />"
					alt="<spring:message code="webapp.locale.china" />" 
					src="<fmt:message key="project.resources.path"/>/images/china.png" /></a></span>
			</div-->
		</div>

		<!-- messages -->
		<%@ include file="../jsp/common/messages.jspf"%>
		<div class="body-content">
			<div class="panel panel-default"
				title="<spring:message code="webapp.page.login.title" />"
				style="width: 400px; height: 256px; margin-bottom: 100px;border: solid 1px #ddd;">
				<div class="panel-body" style="padding: 10px 0; margin: 30px 0;">
					<form id="loginForm" name="loginForm" class="form-horizontal" action="/login" method="post">
						<div class="form-group">
							<label for="username" class="col-sm-4 control-label"><spring:message code="webapp.page.login.username" /></label>
							<div class="col-sm-6">
								<input type="text" name="username" class="form-control" value="${r"${username}"}"
									placeholder="<spring:message code="webapp.page.login.username.placeholder" />" />
							</div>
						</div>
						<div class="form-group">
							<label for="username" class="col-sm-4 control-label"><spring:message code="webapp.page.login.password" /></label>
							<div class="col-sm-6">
								<input type="password" name="password" class="form-control"
									placeholder="<spring:message code="webapp.page.login.password.placeholder" />" />
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-offset-4 col-sm-6">
								<div class="checkbox" style="text-align:left;">
									<label><input type="checkbox" name="rememberMe" value="1"><spring:message code="webapp.page.login.rememberme" /></label>
								</div>
							</div>
						</div>
						<div class="form-group">
							<button id="loginBtn" href="javascript:void(0)"
								class="btn btn-default" onclick="submitForm()"><spring:message
									code="webapp.constant.login" /></button> 
							<button class="btn btn-default" onclick="clearForm();return false;"><spring:message
									code="webapp.constant.reset" /></button>
						</div>
					</form>
				</div>
			</div>
		</div>

		<!-- footer -->
		<%@include file="../jsp/common/footer.jspf"%>
	</center>
	<script>
		function submitForm() {
			$('#loginForm').submit();
		}
		function clearForm() {
			$("#loginForm input[type=text]").val("");
			$("#loginForm input[type=password]").val("");
		}
		$(document).ready(function() {
			$('body').on("keydown", function(event) {
				var key = event.which;
				if (key == 13) {
					event.preventDefault();
					$('#loginBtn').click();
				}
			});
			$("input[name='username']").focus();
		});
	</script>
</body>
</html>

